// Sidebar.h provides the attributes of the Sidebar class
//-----------------

#if !defined( SidebarH)
#define SidebarH

//-----------------
// Includes various libraries and files
#include <cassert>		// for asserts
#include <d3dx9.h>		// Direct 3D library (for all Direct 3D functions)
#include <list>
#include <vector>

#include "ModelAsset.h"
#include "PlacedObject.h"
#include "Toolbar.h"
#include "UserInterface.h"
#include "Window.h"
//-----------------

// constants for which side of the screen the sidebar is
const int LEFT( 0), RIGHT( 1);

class Sidebar
	: public Toolbar
{
	public:
		// constructor and destructor
		Sidebar( const Window& window, UserInterface* p_ui, const int& height, const int& side);
		virtual ~Sidebar();

		// accessors
		int get_button() const;
		int get_asset() const;
		int get_active_button() const;
		virtual void get_button_coordinates( const int& b, int& x, int& y) const;
		virtual bool mouseover_border( const int& x, const int& y) const;

		void get_asset_list_coordinates( int& x, int& y) const;

		// mutators
		void set_width( int x);

		bool mouseover_button( const int& x, const int& y);
		void set_active_button();
		virtual void set_button_coordinates( const int& b, const int& x, const int& y);

		void set_asset_mouseover( const int& a);

		HRESULT setup_geometry( LPDIRECT3DDEVICE9 device);
		void render( LPDIRECT3DDEVICE9 device, const Window& window);

		void reset();

		// enumerated constants for the list of buttons
		const enum enum_Buttons {
			BUTTON_FLOOR,
			BUTTON_SCENERY,
			BUTTON_DOORS,
			BUTTON_CONTAINERS,
			BUTTON_WALLS,
			BUTTON_WAYPOINTS,
			BUTTON_MISC,
			BUTTON_ALL			// the last one is for running through the list in loops
		};

		// Public pointer so it can be used by inherited classes as well
		// ... too lazy to put in a function returning the pointer atm.
		UserInterface* p_ui_;

	private:
		void update_button_positions();

		// constants for the size of the button images
		const int BUTTON_WIDTH, BUTTON_HEIGHT;
		// constants for the width of the sidebar
		const int MIN_WIDTH, MAX_WIDTH;

		int buttons_[BUTTON_ALL][2];
		LPDIRECT3DTEXTURE9 buttons_textures_[BUTTON_ALL][BUTTON_TEXTURE_ALL];

		MeshOrthographic bg_lighter_;
		LPDIRECT3DTEXTURE9 bg_lighter_texture_;

		int list_x_, list_y_;
		int alignment_;
		int button_active_;
		int button_mouseover_, asset_mouseover_;
};

#endif